﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO.IsolatedStorage;

namespace SpeedRun
{
    public class User
    {
        public String Name;
        public float Age;
        public float Weight;
        public BodyType type;
        public Gender gender;
        public static User UserRetrive()
        {
            try
            {
                System.Xml.Serialization.XmlSerializer xmlS = new System.Xml.Serialization.XmlSerializer(typeof(User));
                using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream("user.pfk", System.IO.FileMode.Open, isf))
                {
                    User user;
                    user = (User)xmlS.Deserialize(isfs);
                    isfs.Close();
                    return user;
                }
            }
            catch (Exception _e)
            {
                return new User();
            }
        }


        public static void Save(User currentUser)
        {
            System.Xml.Serialization.XmlSerializer xmlS = new System.Xml.Serialization.XmlSerializer(typeof(User));
            using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream("user.pfk", System.IO.FileMode.OpenOrCreate, isf))
            {
                xmlS.Serialize(isfs, currentUser);
                isfs.Close();
            }
        }

        public static IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
    }

    public
    enum
        BodyType
    {
        Slim = 1,
        Fit = 2 ,
        Fat = 3,
        Athletic = 4,
        Aged = 5,
        Muscular = 0
    }

    public enum Gender 
    {
        male ,
        female
    }

    public enum RunTypes
    {
        Basic,
        Time,
        Distance,
        None
    }
}
